package com.bhs.sansonglogistics.dialog;

import android.content.Context;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.bhs.sansonglogistics.R;
import com.bhs.sansonglogistics.bean.OrderGoodsBean;
import com.bhs.sansonglogistics.utils.DateUtils;
import com.bhs.sansonglogistics.utils.MyUtils;
import com.lxj.xpopup.core.CenterPopupView;

public class ViewCancelDialog extends CenterPopupView {

    private OrderGoodsBean.CancelInfoDTO cancelInfoDTO;
    private TextView mTvCancel;
    private TextView mTvCancelTime;

    public ViewCancelDialog(@NonNull Context context, OrderGoodsBean.CancelInfoDTO cancelInfoDTO) {
        super(context);
        this.cancelInfoDTO = cancelInfoDTO;
    }

    // 设置最大宽度，看需要而定，
    @Override
    protected int getMaxWidth() {
        return MyUtils.getScreenWidth(getContext()) * 10 / 12;
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_view_cancel;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        initView();
        mTvCancel.setText(String.format("取消原因：%s",cancelInfoDTO.getCancel_reason()));
        mTvCancelTime.setText(String.format("取消时间：%s",DateUtils.getTime2(cancelInfoDTO.getCreate_time())));
    }

    private void initView() {
        mTvCancel = findViewById(R.id.tv_cancel);
        mTvCancelTime = findViewById(R.id.tv_cancel_time);
    }
}
